#pragma once

#include <vector>
#include <thread>
#include <Windows.h>

class EventLoop
{
public:
    typedef std::vector<std::thread> ThreadArray;
    typedef ThreadArray::iterator ThreadArrayIte;

    explicit EventLoop(int work_num = 0);
    ~EventLoop();

private:
    EventLoop(const EventLoop&) = delete;
    EventLoop& operator=(const EventLoop&) = delete;
    EventLoop(const EventLoop&&) = delete;
    EventLoop& operator=(const EventLoop&&) = delete;

    void Start(int work_num);
    void Stop();
    void WorkerProc();
    bool IsSameThread();

private:
    HANDLE iocp_;
    std::thread::id cur_id_;
    ThreadArray workers_;
};